package com.lanhai.zhonglai;
 
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.lanhai.zhonglai.dao.RoadDao;
import com.lanhai.zhonglai.dao.StationGroupDao;
import com.lanhai.zhonglai.interfaces.IDot;
import com.lanhai.zhonglai.interfaces.IPower;
import com.lanhai.zhonglai.interfaces.IRoad;
import com.lanhai.zhonglai.interfaces.IStation;

@Component
public class Test {
	@Autowired
	IStation iStation;
	
	@Autowired
	IDot iDot;
	
	@Autowired
	IRoad iRoad;
	
	@Autowired
	IPower iPower;
	
	
	void test () {
		/*
		iDot.init();
		if(iDot.isNearTransDot(88, -760, -696)==false){
    		//AGV超过了机台一定的范围，释放机台
    		iStation.unlockStationForDot(88, 3);
        	 
    	} else {
    		System.out.print("not find");
    	}
    	*/
		iRoad.init();
		iStation.init();
		 
		
		StationGroupDao gbean=iStation.fetchNextInStation(350, 28, "制绒上料", 0, false);
		
		if(gbean!=null){
    		 
			RoadDao road    =iRoad.getTransRoad(350, gbean.getDotno());
			if (road != null && road.getId() > 0) {
				//有特殊路线，但没有定线
				 System.out.println(road.getId());
			} else {
				System.out.println(  String.format("%d到%d缺少路线", 201, gbean.getDotno()));
			} 
        	 
    	} else {
    		System.out.println("not find");
    	}
		
	}
	
	void test11 () {
	 
		iStation.init();
		 	StationGroupDao dao=iStation.fetchNextInStation(451, 13, "ALD湿法", 0,true);
			if(dao!=null){
	    		//AGV超过了机台一定的范围，释放机台
	    		 System.out.println(dao.getStationname());
	        	 
	    	} else {
	    		System.out.println("not find");
	    	}
		 for(int i=14;i<50;i++) {
			 StationGroupDao xb=iStation.fetchNextInStation(451, i, "ALD湿法", 0,true);
				if(xb!=null){
		    		//AGV超过了机台一定的范围，释放机台
		    		 System.out.println(xb.getStationname()+"  has find"); 
		    	} else {
		    		System.out.println(i+"not find ");
		    	}
		 }
		 
	}
	
	void testpower() {
		iPower.init();
		iPower.agvBackToWork();
	}
	
	
	void testroad() {
		iRoad.init();
		iStation.init();


		RoadDao road=iRoad.getTransRoad(473,180); 
		if (road!=null &&road.getId() > 0) {
			//空车，有特殊路线，也没有定线
			System.out.println("有路线"+road.getId());
		} else {
			System.out.println("没有路线");
		}
	}
}
